jsMath

Osnovne statisticke naredbe

""" Ivana Pilizota, Helena Vrljic """ 
       
podaci=[6, 3, 3, 3, 5, 5, 6, 3, 2, 2, 5, 6, 1, 2, 2, 3, 4, 6, 2, 3] 
       
mean(podaci) 
       
18/5
variance(podaci) 
       
254/95
float(std(podaci)) 
       
1.6351404253232551
mode(podaci) 
       
[3]
median(podaci) 
       
3
J=range(1,7) 
       
s = IndexedSequence([1,5,6,1,3,4],J) 
       
s.plot_histogram() 
       
s.plot_histogram(eps=0.3,clr=(1,0,0)) 
       
[random() for i in [1 .. 5]] 
       
[0.23587442167893968, 0.13705855581143145, 0.17913315204068792,
0.55144435945055037, 0.88136163812929547]
#R 
       
podacir<-c(6, 3, 3, 3, 5, 5, 6, 3, 2, 2, 5, 6, 1, 2, 2, 3, 4, 6, 2, 3) 
       
mean(podacir) 
       
[1] 3.6
var(podacir) 
       
[1] 2.673684
summary(podacir) 
       
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
    1.0     2.0     3.0     3.6     5.0     6.0 
runif(5) 
       
[1] 0.4355594 0.3767255 0.1643622 0.6505409 0.6378923